//结构体做函数参数
#include<iostream>
#include<string.h>

using namespace std;

struct Student
{
	string name;
	int age;
	int score;
};

//值传递
void printfStudent1(Student a)
{
	a.age = 100;
	cout << " 子函数1中打印 姓名：" << a.name
		<< " 年龄：" << a.age
		<< " 成绩：" << a.score << endl;
}

//地址传递
void printfStudent2(Student* p)
{
	p->age = 99;
	cout << " 子函数2中打印 姓名：" << p->name
		<< " 年龄：" << p->age
		<< " 成绩：" << p->score << endl;
}
int main()
{
	Student s;
	s.name = "张三";
	s.age = 19;
	s.score = 100;

	printfStudent1(s);
	printfStudent2(&s);
	cout << " main函数中打印 姓名：" << s.name
		<< " 年龄：" << s.age
		<< " 成绩：" << s.score << endl;
	system("pause"); 
	return 0;
}
